<template>
    <el-form :model="form" label-width="auto" :inline="true"><div>
        <el-form-item label="转种日期"  style="width: 500px;">
            <el-col :span="11">
                <el-date-picker v-model="form.transplantingDate" type="date" placeholder="请选择" style="width: 100%" />
            </el-col>
            <el-col :span="11">
                <el-date-picker v-model="form.jTransplantingDate" type="date" placeholder="请选择" style="width: 100%" />
            </el-col>
        </el-form-item>
        <!-- <el-form-item label="育成羊耳号"  style="width: 250px;">
            <el-select v-model="form.breedingSheepArchiveId" placeholder="请选择">
                <el-option v-for="a in bugles" :label="a.auricle" :value="a.breedingSheepArchiveId" />
            </el-select>
        </el-form-item> -->
    </div></el-form>
    
    <el-button type="success" @click="getlist()">查询</el-button>
    <el-table :data="list" style="width: 100%">
        <el-table-column prop="descendentId" label="序号" />
        <el-table-column prop="transplantingDate" label="转种日期">
            <template v-slot="scope">
                {{ scope.row.transplantingDate.substring(0, 10) }}
            </template>
        </el-table-column>
        <el-table-column prop="auricle" label="育成羊耳号" />
        <el-table-column prop="bEnter" label="转入栋舍" />
        <el-table-column prop="cEnter" label="转入栏位" />
        <el-table-column prop="building" label="当前栋舍" />
        <el-table-column prop="columns" label="当前栏位" />
        <el-table-column prop="sex" label="性别" />
        <el-table-column prop="age" label="断奶日龄" />
    </el-table>
</template>
<script setup lang="ts">
import { reactive, ref, onMounted } from 'vue'
import axios from 'axios';
const form = reactive({
    transplantingDate: "",
    jTransplantingDate: "",
    breedingSheepArchiveId: ""

})

//转出栋舍

//栋舍类型
const building = ref([])
const getbuilding = () => {
    axios.post("http://localhost:5012/api/Buildings/BuildingTypeBind", {}).then(res => {
        console.log(res)
        building.value = res.data.data
    })
}
//耳号下拉框
const bugles = ref([])
const getsheepvariety = () => {
    axios.post("http://localhost:5012/api/SheepFile/BasicInformationList", {}).then(res => {
        console.log(res)
        bugles.value = res.data.data
    })
}
const list = ref([])
const getlist = () => {
    axios.post("http://localhost:5012/api/Prompt/TransplantingList", {
        transplantingDate: form.transplantingDate,
        jTransplantingDate: form.jTransplantingDate,
        breedingSheepArchiveId: form.breedingSheepArchiveId||0
    }).then(res => {
        list.value = res.data.data
    })
}
onMounted(() => {
    getlist()
    getsheepvariety()
    getbuilding()
})
</script>